package com.bosssoft.trainee.mbg.vo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;

/**
 * @Author: wuxin
 * @Date: 2022/6/21
 * @Project: rbac
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserVO {
    private Integer  id;
    @NotBlank(message = "用户名不能为空")
    @Length(min = 4,max = 16,message = "用户名长度在 4 到 16 个字符")
    @Pattern(regexp = "^[a-zA-Z0-9_-]{4,16}$",message = "用户名只能由字母、数字、\"_\"、\"-\"组成")
    private String username;
    @NotBlank(message = "密码不能为空")
    @Length(min = 6,max = 20,message = "密码长度在 6 到 20 个字符")
    @Pattern(regexp = "^(?=.*\\d)(?=.*[a-zA-Z]).{6,20}$",message = "密码至少包含一个字母和一个数字")
    private String password;
    @NotBlank(message = "邮箱不能为空")
    @Email(message = "请输入正确的邮箱")
    private String email;
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^((13\\d)|(17[0-1,6-8])|(15[^4,\\\\D])|(18\\d))\\d{8}$",message = "手机号格式不正确")
    private String phone;
    @NotBlank(message = "工号不能为空")
    @Pattern(regexp = "^[A-Z]{2}\\d{6}$",message = "工号格式不正确")
    private String workerNum;
    @NotNull(message = "性别不能为空")
    private Integer sex;
    private Date birthday;
    private Integer companyId;
    @NotNull(message = "部门id不能为空")
    private Integer departmentId;
    @NotNull(message = "职位id不能为空")
    private Integer positionId;
    @NotEmpty(message = "角色不能为空")
    private List<Integer> roleIds;
    private Integer state;
    private List<Integer> resources;
}
